#include<iostream>
using namespace std;
const int N = 1e6 + 10;
int prime[N];
bool st[N];
int cnt;
int main()
{
	int n;
	cin >> n;
	for (int i = 2; i <= n; i++) {
		if (!st[i]) {
			prime[cnt++] = i;
			for (int j = i * 2; j <= n; j += i) {
				st[j] = 1;
			}
		}
	}
	cout << cnt << endl;
	for (int i = 0; i < cnt; i++) {
		cout << prime[i] << " ";
	}
	return 0;
}